"ID","Name", "Code", "Barcode", "Brand", "Video link", "Price", "Discount Price", "GroupID"<?php echo "\n" ?>
<?php foreach($prods as $prod): ?>
  <?php $groups = ''; ?>
  <?php foreach($prod['ProductGroups'][0] as $group): ?>
    <?php if ($group['id'] != 1): ?>
      <?php $groups[] = $group['id']; ?>
    <?php endif; ?>
  <?php endforeach; ?>
"<?php echo $prod['id'] ?>","<?php echo $prod['name']?>","<?php echo $prod['code']?>","<?php echo $prod['barcode']?>","<?php echo $prod['brand_name']?>","<?php echo $prod['video_link']?>","<?php echo $prod['price']?>","<?php echo $prod['discount_price']?>","<?php echo !empty($groups) ? implode(',', $groups) : ''; ?>"<?php echo "\n"?>
<?php endforeach; ?>